#include <cuda.h>
#include <cuda_runtime.h>
#include "vhf.cuh"
#include "rys_roots_for_k.cu"
#include "create_tasks.cu"


__global__ static
void rys_ejk_ip2_type3_0000(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double fikx, fiky, fikz;
        double fjkx, fjky, fjkz;
        double filx, fily, filz;
        double fjlx, fjly, fjlz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        double dd_cache0 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    dd = dd_cache0;
                    Ix = 1;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    fix = ai2 * trr_10x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double trr_01x = cpx * 1;
                    fkx = ak2 * trr_01x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    fky = ak2 * trr_01y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    fikx = ai2 * trr_11x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    fiky = ai2 * trr_11y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    fikz = ai2 * trr_11z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fjx = aj2 * hrr_0100x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    fjkx = aj2 * hrr_0110x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_10z;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    flx = al2 * hrr_0001x;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    fly = al2 * hrr_0001y;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    filx = ai2 * hrr_1001x;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    fily = ai2 * hrr_1001y;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    filz = ai2 * hrr_1001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_0101x = hrr_1001x - xjxi * hrr_0001x;
                    fjlx = aj2 * hrr_0101x;
                    double hrr_0101y = hrr_1001y - yjyi * hrr_0001y;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0101z = hrr_1001z - zjzi * hrr_0001z;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1000(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double fikx, fiky, fikz;
        double fjkx, fjky, fjkz;
        double filx, fily, filz;
        double fjlx, fjly, fjlz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    dd = dd_cache0;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    fix = ai2 * trr_20x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    fkx = ak2 * trr_11x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    fky = ak2 * trr_01y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    fikx = ai2 * trr_21x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    fiky = ai2 * trr_11y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    fikz = ai2 * trr_11z;
                    double trr_01x = cpx * 1;
                    fikx -= 1 * trr_01x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    fjx = aj2 * hrr_1100x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    fjkx = aj2 * hrr_1110x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    flx = al2 * hrr_1001x;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    fly = al2 * hrr_0001y;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    double hrr_2001x = trr_21x - xlxk * trr_20x;
                    filx = ai2 * hrr_2001x;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    fily = ai2 * hrr_1001y;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    filz = ai2 * hrr_1001z;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    filx -= 1 * hrr_0001x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0100y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_1101x = hrr_2001x - xjxi * hrr_1001x;
                    fjlx = aj2 * hrr_1101x;
                    double hrr_0101y = hrr_1001y - yjyi * hrr_0001y;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0101z = hrr_1001z - zjzi * hrr_0001z;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache1;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    fiky = ai2 * trr_21y;
                    fikz = ai2 * trr_11z;
                    fiky -= 1 * trr_01y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fjx = aj2 * hrr_0100x;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    fjkx = aj2 * hrr_0110x;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    fjky = aj2 * hrr_1110y;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    double hrr_2001y = trr_21y - ylyk * trr_20y;
                    fily = ai2 * hrr_2001y;
                    filz = ai2 * hrr_1001z;
                    fily -= 1 * hrr_0001y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_0101x = hrr_1001x - xjxi * hrr_0001x;
                    fjlx = aj2 * hrr_0101x;
                    double hrr_1101y = hrr_2001y - yjyi * hrr_1001y;
                    fjly = aj2 * hrr_1101y;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache2;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_11y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    fikz = ai2 * trr_21z;
                    fikz -= 1 * trr_01z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    fjz = aj2 * hrr_1100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    fjkz = aj2 * hrr_1110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_1001y;
                    double hrr_2001z = trr_21z - zlzk * trr_20z;
                    filz = ai2 * hrr_2001z;
                    filz -= 1 * hrr_0001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    fjz = aj2 * hrr_1100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_1101z = hrr_2001z - zjzi * hrr_1001z;
                    fjlz = aj2 * hrr_1101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1010(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double fikx, fiky, fikz;
        double fjkx, fjky, fjkz;
        double filx, fily, filz;
        double fjlx, fjly, fjlz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        double dd_cache3 = 0.;
        double dd_cache4 = 0.;
        double dd_cache5 = 0.;
        double dd_cache6 = 0.;
        double dd_cache7 = 0.;
        double dd_cache8 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+1)]);
                dd_cache4 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+1)]);
                dd_cache5 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+1)]);
                dd_cache6 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+2)]);
                dd_cache7 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+2)]);
                dd_cache8 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+2)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache3 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache4 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache5 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache6 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache7 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache8 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+1)]);
                dd_cache4 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+1)]);
                dd_cache5 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+1)]);
                dd_cache6 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+2)]);
                dd_cache7 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+2)]);
                dd_cache8 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+2)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache3 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache4 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache5 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache6 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache7 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache8 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    dd = dd_cache0;
                    Ix = trr_11x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    fix = ai2 * trr_21x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    double trr_01x = cpx * 1;
                    fix -= 1 * trr_01x;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_12x = cpx * trr_11x + 1*b01 * trr_10x + 1*b00 * trr_01x;
                    fkx = ak2 * trr_12x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    fky = ak2 * trr_01y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    fkz = ak2 * trr_01z;
                    fkx -= 1 * trr_10x;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    double trr_22x = cpx * trr_21x + 1*b01 * trr_20x + 2*b00 * trr_11x;
                    fikx = ai2 * trr_22x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    fiky = ai2 * trr_11y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    fikz = ai2 * trr_11z;
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    fikx -= 1 * trr_02x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikx -= 1 * (ai2 * trr_20x - 1 * 1);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    fjx = aj2 * hrr_1110x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_12x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_01z;
                    fkx -= 1 * trr_10x;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_1120x = trr_22x - xjxi * trr_12x;
                    fjkx = aj2 * hrr_1120x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    fjkx -= 1 * (aj2 * hrr_1100x);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache1;
                    Ix = trr_01x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_11x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    fkx = ak2 * trr_02x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    fkx -= 1 * 1;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_12x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    fiky = ai2 * trr_21y;
                    fikz = ai2 * trr_11z;
                    fiky -= 1 * trr_01y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikx -= 1 * (ai2 * trr_10x);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    fjx = aj2 * hrr_0110x;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_02x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    fkx -= 1 * 1;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_0120x = trr_12x - xjxi * trr_02x;
                    fjkx = aj2 * hrr_0120x;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    fjky = aj2 * hrr_1110y;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fjkx -= 1 * (aj2 * hrr_0100x);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache2;
                    Ix = trr_01x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_11x;
                    fiy = ai2 * trr_10y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    fkx = ak2 * trr_02x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    fkx -= 1 * 1;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_12x;
                    fiky = ai2 * trr_11y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    fikz = ai2 * trr_21z;
                    fikz -= 1 * trr_01z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikx -= 1 * (ai2 * trr_10x);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0110x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    fjz = aj2 * hrr_1100z;
                    fkx = ak2 * trr_02x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    fkx -= 1 * 1;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0120x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    fjkz = aj2 * hrr_1110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjkx -= 1 * (aj2 * hrr_0100x);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = trr_01y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_11y;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    fkx = ak2 * trr_11x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    fky = ak2 * trr_02y;
                    fkz = ak2 * trr_01z;
                    fky -= 1 * 1;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_21x;
                    double trr_12y = cpy * trr_11y + 1*b01 * trr_10y + 1*b00 * trr_01y;
                    fiky = ai2 * trr_12y;
                    fikz = ai2 * trr_11z;
                    fikx -= 1 * trr_01x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fiky -= 1 * (ai2 * trr_10y);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0110y;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_02y;
                    fkz = ak2 * trr_01z;
                    fky -= 1 * 1;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_1110x;
                    double hrr_0120y = trr_12y - yjyi * trr_02y;
                    fjky = aj2 * hrr_0120y;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjky -= 1 * (aj2 * hrr_0100y);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = trr_11y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_21y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * trr_01y;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_12y;
                    fkz = ak2 * trr_01z;
                    fky -= 1 * trr_10y;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    double trr_22y = cpy * trr_21y + 1*b01 * trr_20y + 2*b00 * trr_11y;
                    fiky = ai2 * trr_22y;
                    fikz = ai2 * trr_11z;
                    fiky -= 1 * trr_02y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fiky -= 1 * (ai2 * trr_20y - 1 * 1);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1110y;
                    fjz = aj2 * hrr_0100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_12y;
                    fkz = ak2 * trr_01z;
                    fky -= 1 * trr_10y;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    double hrr_1120y = trr_22y - yjyi * trr_12y;
                    fjky = aj2 * hrr_1120y;
                    fjkz = aj2 * hrr_0110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjky -= 1 * (aj2 * hrr_1100y);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = trr_01y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_11y;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_02y;
                    fkz = ak2 * trr_11z;
                    fky -= 1 * 1;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_12y;
                    fikz = ai2 * trr_21z;
                    fikz -= 1 * trr_01z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fiky -= 1 * (ai2 * trr_10y);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0110y;
                    fjz = aj2 * hrr_1100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_02y;
                    fkz = ak2 * trr_11z;
                    fky -= 1 * 1;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_0120y;
                    fjkz = aj2 * hrr_1110z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjky -= 1 * (aj2 * hrr_0100y);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_11z;
                    fix -= 1 * 1;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_01y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    fkz = ak2 * trr_02z;
                    fkz -= 1 * wt;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_21x;
                    fiky = ai2 * trr_11y;
                    double trr_12z = cpz * trr_11z + 1*b01 * trr_10z + 1*b00 * trr_01z;
                    fikz = ai2 * trr_12z;
                    fikx -= 1 * trr_01x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikz -= 1 * (ai2 * trr_10z);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0100y;
                    fjz = aj2 * hrr_0110z;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_02z;
                    fkz -= 1 * wt;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_1110x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0120z = trr_12z - zjzi * trr_02z;
                    fjkz = aj2 * hrr_0120z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjkz -= 1 * (aj2 * hrr_0100z);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_11z;
                    fiy -= 1 * 1;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_02z;
                    fkz -= 1 * wt;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_21y;
                    fikz = ai2 * trr_12z;
                    fiky -= 1 * trr_01y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikz -= 1 * (ai2 * trr_10z);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0110z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_02z;
                    fkz -= 1 * wt;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_1110y;
                    fjkz = aj2 * hrr_0120z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjkz -= 1 * (aj2 * hrr_0100z);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_11z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_21z;
                    fiz -= 1 * trr_01z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_12z;
                    fkz -= 1 * trr_10z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_11y;
                    double trr_22z = cpz * trr_21z + 1*b01 * trr_20z + 2*b00 * trr_11z;
                    fikz = ai2 * trr_22z;
                    fikz -= 1 * trr_02z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    fikz -= 1 * (ai2 * trr_20z - 1 * wt);
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    fjz = aj2 * hrr_1110z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_12z;
                    fkz -= 1 * trr_10z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_1120z = trr_22z - zjzi * trr_12z;
                    fjkz = aj2 * hrr_1120z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    fjkz -= 1 * (aj2 * hrr_1100z);
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    }
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    dd = dd_cache0;
                    Ix = trr_11x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    fix = ai2 * trr_21x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    double trr_01x = cpx * 1;
                    fix -= 1 * trr_01x;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_12x = cpx * trr_11x + 1*b01 * trr_10x + 1*b00 * trr_01x;
                    double hrr_1011x = trr_12x - xlxk * trr_11x;
                    flx = al2 * hrr_1011x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    fly = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    double trr_22x = cpx * trr_21x + 1*b01 * trr_20x + 2*b00 * trr_11x;
                    double hrr_2011x = trr_22x - xlxk * trr_21x;
                    filx = ai2 * hrr_2011x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    fily = ai2 * hrr_1001y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    filz = ai2 * hrr_1001z;
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    double hrr_0011x = trr_02x - xlxk * trr_01x;
                    filx -= 1 * hrr_0011x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    fjx = aj2 * hrr_1110x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_1011x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_1111x = hrr_2011x - xjxi * hrr_1011x;
                    fjlx = aj2 * hrr_1111x;
                    double hrr_0101y = hrr_1001y - yjyi * hrr_0001y;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0101z = hrr_1001z - zjzi * hrr_0001z;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache1;
                    Ix = trr_01x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_11x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    flx = al2 * hrr_0011x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1011x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    double hrr_2001y = trr_21y - ylyk * trr_20y;
                    fily = ai2 * hrr_2001y;
                    filz = ai2 * hrr_1001z;
                    fily -= 1 * hrr_0001y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    fjx = aj2 * hrr_0110x;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_0011x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_0111x = hrr_1011x - xjxi * hrr_0011x;
                    fjlx = aj2 * hrr_0111x;
                    double hrr_1101y = hrr_2001y - yjyi * hrr_1001y;
                    fjly = aj2 * hrr_1101y;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache2;
                    Ix = trr_01x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_11x;
                    fiy = ai2 * trr_10y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    flx = al2 * hrr_0011x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1011x;
                    fily = ai2 * hrr_1001y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    double hrr_2001z = trr_21z - zlzk * trr_20z;
                    filz = ai2 * hrr_2001z;
                    filz -= 1 * hrr_0001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0110x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    fjz = aj2 * hrr_1100z;
                    flx = al2 * hrr_0011x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0111x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_1101z = hrr_2001z - zjzi * hrr_1001z;
                    fjlz = aj2 * hrr_1101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = trr_01y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_11y;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    flx = al2 * hrr_1001x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    double hrr_0011y = trr_02y - ylyk * trr_01y;
                    fly = al2 * hrr_0011y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    double hrr_2001x = trr_21x - xlxk * trr_20x;
                    filx = ai2 * hrr_2001x;
                    double trr_12y = cpy * trr_11y + 1*b01 * trr_10y + 1*b00 * trr_01y;
                    double hrr_1011y = trr_12y - ylyk * trr_11y;
                    fily = ai2 * hrr_1011y;
                    filz = ai2 * hrr_1001z;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    filx -= 1 * hrr_0001x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    fjx = aj2 * hrr_1100x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    fjy = aj2 * hrr_0110y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0011y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_1101x = hrr_2001x - xjxi * hrr_1001x;
                    fjlx = aj2 * hrr_1101x;
                    double hrr_0111y = hrr_1011y - yjyi * hrr_0011y;
                    fjly = aj2 * hrr_0111y;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = trr_11y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_21y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * trr_01y;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1011y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    double trr_22y = cpy * trr_21y + 1*b01 * trr_20y + 2*b00 * trr_11y;
                    double hrr_2011y = trr_22y - ylyk * trr_21y;
                    fily = ai2 * hrr_2011y;
                    filz = ai2 * hrr_1001z;
                    fily -= 1 * hrr_0011y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fjx = aj2 * hrr_0100x;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    fjy = aj2 * hrr_1110y;
                    fjz = aj2 * hrr_0100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1011y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_0101x = hrr_1001x - xjxi * hrr_0001x;
                    fjlx = aj2 * hrr_0101x;
                    double hrr_1111y = hrr_2011y - yjyi * hrr_1011y;
                    fjly = aj2 * hrr_1111y;
                    fjlz = aj2 * hrr_0101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = trr_01y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_11y;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0011y;
                    flz = al2 * hrr_1001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_1011y;
                    filz = ai2 * hrr_2001z;
                    filz -= 1 * hrr_0001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0110y;
                    fjz = aj2 * hrr_1100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0011y;
                    flz = al2 * hrr_1001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_0111y;
                    fjlz = aj2 * hrr_1101z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_11z;
                    fix -= 1 * 1;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0001y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    double hrr_0011z = trr_02z - zlzk * trr_01z;
                    flz = al2 * hrr_0011z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_2001x;
                    fily = ai2 * hrr_1001y;
                    double trr_12z = cpz * trr_11z + 1*b01 * trr_10z + 1*b00 * trr_01z;
                    double hrr_1011z = trr_12z - zlzk * trr_11z;
                    filz = ai2 * hrr_1011z;
                    filx -= 1 * hrr_0001x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    fjz = aj2 * hrr_0110z;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0011z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_1101x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0111z = hrr_1011z - zjzi * hrr_0011z;
                    fjlz = aj2 * hrr_0111z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_11z;
                    fiy -= 1 * 1;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0011z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_2001y;
                    filz = ai2 * hrr_1011z;
                    fily -= 1 * hrr_0001y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0110z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0011z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_1101y;
                    fjlz = aj2 * hrr_0111z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_11z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * trr_21z;
                    fiz -= 1 * trr_01z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1011z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_1001y;
                    double trr_22z = cpz * trr_21z + 1*b01 * trr_20z + 2*b00 * trr_11z;
                    double hrr_2011z = trr_22z - zlzk * trr_21z;
                    filz = ai2 * hrr_2011z;
                    filz -= 1 * hrr_0011z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    fjz = aj2 * hrr_1110z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1011z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_1111z = hrr_2011z - zjzi * hrr_1011z;
                    fjlz = aj2 * hrr_1111z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1011(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 64;
    constexpr int gout_stride = 4;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 1728 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 60 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (60+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[64] = ylyk;
            rlrk[128] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double gix, giy, giz;
        double gjx, gjy, gjz;
        double gkx, gky, gkz;
        double glx, gly, glz;
        double gikx, giky, gikz;
        double gjkx, gjky, gjkz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 3;
                int ij = n % 3;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 3;
                int ij = n % 3;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[64];
                double zlzk = rlrk[128];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[64] * al_akl;
                double zkl = rk[2] + rlrk[128] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[64] = ypq;
                    Rpq[128] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1152] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*128];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 4) {
                        if (n == 2) {
                            gx[2304] = rw[irys*128+64];
                        }
                        double *_gx = gx + n * 1152;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*64];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[64] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[128] = s2;
                        double xlxk = rlrk[n*64];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*64];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[192] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[384] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        _gx[576] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[256] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[192];
                        _gx[448] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 1 * b00 * _gx[384];
                        _gx[640] = s2;
                        s0 = _gx[128];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[64];
                        _gx[320] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[256];
                        _gx[512] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 2 * b00 * _gx[448];
                        _gx[704] = s2;
                        s1 = _gx[576];
                        s0 = _gx[384];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[768] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[576] = s1 - xlxk * s0;
                        s1 = _gx[640];
                        s0 = _gx[448];
                        _gx[1024] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[256];
                        _gx[832] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[640] = s1 - xlxk * s0;
                        s1 = _gx[704];
                        s0 = _gx[512];
                        _gx[1088] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[704] = s1 - xlxk * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[832];
                    Iy = gx[1152];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[896];
                    giy = gx[1216];
                    giz = gx[2368];
                    gkx = gx[1024];
                    gky = gx[1344];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[768];
                    fkx = ak2 * gkx - 1 * gx[640];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[256];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1088];
                    giky = gx[1408];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[960]) - 1 * (ai2 * gx[704] - 1 * gx[576])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[704] - xjxi * gx[640])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[960] - xlxk * gx[768])) - 1 * (ai2 * gx[320] - 1 * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[320] - xjxi * gx[256])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[576];
                    Iy = gx[1408];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1472];
                    giz = gx[2368];
                    gkx = gx[768];
                    gky = gx[1600];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1216];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1664];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[576];
                    Iy = gx[1152];
                    Iz = gx[2560];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1216];
                    giz = gx[2624];
                    gkx = gx[768];
                    gky = gx[1344];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2368];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1408];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[64];
                    Iy = gx[1920];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1984];
                    giz = gx[2368];
                    gkx = gx[256];
                    gky = gx[2112];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[2176];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1792]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1792] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1408]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1408] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1024];
                    Ix = gx[0];
                    Iy = gx[1792];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1856];
                    giz = gx[2560];
                    gkx = gx[192];
                    gky = gx[1984];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1216];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2048];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1280];
                    Ix = gx[192];
                    Iy = gx[1152];
                    Iz = gx[2944];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1216];
                    giz = gx[3008];
                    gkx = gx[384];
                    gky = gx[1344];
                    gkz = gx[3136];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2368];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1408];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    dd = dd_cache[1536];
                    Ix = gx[64];
                    Iy = gx[1152];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1216];
                    giz = gx[3136];
                    gkx = gx[256];
                    gky = gx[1344];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1408];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2944]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2944] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2560]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2560] - zjzi * gx[2496])) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[64];
                    Ix = gx[768];
                    Iy = gx[1216];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[832];
                    giy = gx[1280];
                    giz = gx[2368];
                    gkx = gx[960];
                    gky = gx[1408];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1472];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[640]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[640] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[256]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[256] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[576];
                    Iy = gx[1344];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1408];
                    giz = gx[2432];
                    gkx = gx[768];
                    gky = gx[1536];
                    gkz = gx[2560];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1600];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[256];
                    Iy = gx[1728];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1792];
                    giz = gx[2368];
                    gkx = gx[448];
                    gky = gx[1920];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[64];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1984];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[0];
                    Iy = gx[1984];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[2048];
                    giz = gx[2368];
                    gkx = gx[192];
                    gky = gx[2176];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1920];
                    fky = ak2 * gky - 1 * gx[1792];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1408];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2240];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[2112]) - 1 * (ai2 * gx[1856] - 1 * gx[1728])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1856] - yjyi * gx[1792])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2112] - ylyk * gx[1920])) - 1 * (ai2 * gx[1472] - 1 * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1472] - yjyi * gx[1408])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1088];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[2560];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1792];
                    giz = gx[2624];
                    gkx = gx[192];
                    gky = gx[1920];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2368];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1984];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1344];
                    Ix = gx[64];
                    Iy = gx[1344];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1408];
                    giz = gx[2944];
                    gkx = gx[256];
                    gky = gx[1536];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1600];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[1600];
                    Ix = gx[0];
                    Iy = gx[1216];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1280];
                    giz = gx[3136];
                    gkx = gx[192];
                    gky = gx[1408];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1472];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2944]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2944] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2560]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2560] - zjzi * gx[2496])) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[128];
                    Ix = gx[768];
                    Iy = gx[1152];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[832];
                    giy = gx[1216];
                    giz = gx[2432];
                    gkx = gx[960];
                    gky = gx[1344];
                    gkz = gx[2560];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1408];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[640]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[640] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[256]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[256] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[640];
                    Iy = gx[1152];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1216];
                    giz = gx[2560];
                    gkx = gx[832];
                    gky = gx[1344];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[64];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1408];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[192];
                    Iy = gx[1792];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1856];
                    giz = gx[2368];
                    gkx = gx[384];
                    gky = gx[1984];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1216];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[2048];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[896];
                    Ix = gx[0];
                    Iy = gx[1920];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1984];
                    giz = gx[2432];
                    gkx = gx[192];
                    gky = gx[2112];
                    gkz = gx[2560];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2176];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1792]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1792] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1408]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1408] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1152];
                    Ix = gx[256];
                    Iy = gx[1152];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1216];
                    giz = gx[2944];
                    gkx = gx[448];
                    gky = gx[1344];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[64];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1408];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[1408];
                    Ix = gx[0];
                    Iy = gx[1408];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1472];
                    giz = gx[2944];
                    gkx = gx[192];
                    gky = gx[1600];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1216];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1664];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[1664];
                    Ix = gx[0];
                    Iy = gx[1152];
                    Iz = gx[3136];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1216];
                    giz = gx[3200];
                    gkx = gx[192];
                    gky = gx[1344];
                    gkz = gx[3328];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[3072];
                    fkz = ak2 * gkz - 1 * gx[2944];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2560];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1408];
                    gikz = gx[3392];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3264]) - 1 * (ai2 * gx[3008] - 1 * gx[2880])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[3008] - zjzi * gx[2944])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3264] - zlzk * gx[3072])) - 1 * (ai2 * gx[2624] - 1 * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2624] - zjzi * gx[2560])) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[192];
                    Ix = gx[640];
                    Iy = gx[1344];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1408];
                    giz = gx[2368];
                    gkx = gx[832];
                    gky = gx[1536];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[64];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1600];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[576];
                    Iy = gx[1216];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1280];
                    giz = gx[2560];
                    gkx = gx[768];
                    gky = gx[1408];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1472];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[192];
                    Iy = gx[1728];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1792];
                    giz = gx[2432];
                    gkx = gx[384];
                    gky = gx[1920];
                    gkz = gx[2560];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1984];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[960];
                    Ix = gx[64];
                    Iy = gx[1728];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1792];
                    giz = gx[2560];
                    gkx = gx[256];
                    gky = gx[1920];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1984];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1216];
                    Ix = gx[192];
                    Iy = gx[1216];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1280];
                    giz = gx[2944];
                    gkx = gx[384];
                    gky = gx[1408];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1472];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[1472];
                    Ix = gx[0];
                    Iy = gx[1344];
                    Iz = gx[2944];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1408];
                    giz = gx[3008];
                    gkx = gx[192];
                    gky = gx[1536];
                    gkz = gx[3136];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2368];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1600];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1100(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double fikx, fiky, fikz;
        double fjkx, fjky, fjkz;
        double filx, fily, filz;
        double fjlx, fjly, fjlz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        double dd_cache3 = 0.;
        double dd_cache4 = 0.;
        double dd_cache5 = 0.;
        double dd_cache6 = 0.;
        double dd_cache7 = 0.;
        double dd_cache8 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache4 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache5 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache6 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache7 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache8 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache3 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+0)];
                dd_cache4 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+1)];
                dd_cache5 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+2)];
                dd_cache6 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+0)];
                dd_cache7 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+1)];
                dd_cache8 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache4 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache5 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache6 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache7 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache8 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache3 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+0)]+dmb[(j0+1)*nao+(i0+0)]);
                dd_cache4 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+1)]+dmb[(j0+1)*nao+(i0+1)]);
                dd_cache5 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+2)]+dmb[(j0+1)*nao+(i0+2)]);
                dd_cache6 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+0)]+dmb[(j0+2)*nao+(i0+0)]);
                dd_cache7 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+1)]+dmb[(j0+2)*nao+(i0+1)]);
                dd_cache8 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+2)]+dmb[(j0+2)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    dd = dd_cache0;
                    Ix = hrr_1100x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double trr_30x = c0x * trr_20x + 2*b10 * trr_10x;
                    double hrr_2100x = trr_30x - xjxi * trr_20x;
                    fix = ai2 * hrr_2100x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fix -= 1 * hrr_0100x;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double b00 = .5 * rt_aa;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    fkx = ak2 * hrr_1110x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    fky = ak2 * trr_01y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    double trr_31x = cpx * trr_30x + 3*b00 * trr_20x;
                    double hrr_2110x = trr_31x - xjxi * trr_21x;
                    fikx = ai2 * hrr_2110x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    fiky = ai2 * trr_11y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    fikz = ai2 * trr_11z;
                    double trr_01x = cpx * 1;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    fikx -= 1 * hrr_0110x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_1200x = hrr_2100x - xjxi * hrr_1100x;
                    fjx = aj2 * hrr_1200x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    fjx -= 1 * trr_10x;
                    fkx = ak2 * hrr_1110x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_1210x = hrr_2110x - xjxi * hrr_1110x;
                    fjkx = aj2 * hrr_1210x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    fjkz = aj2 * hrr_0110z;
                    fjkx -= 1 * trr_11x;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache1;
                    Ix = hrr_0100x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * hrr_1100x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    fkx = ak2 * hrr_0110x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * hrr_1110x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    fiky = ai2 * trr_21y;
                    fikz = ai2 * trr_11z;
                    fiky -= 1 * trr_01y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    fjx = aj2 * hrr_0200x;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    fjx -= 1 * 1;
                    fkx = ak2 * hrr_0110x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    double hrr_0210x = hrr_1110x - xjxi * hrr_0110x;
                    fjkx = aj2 * hrr_0210x;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    fjky = aj2 * hrr_1110y;
                    fjkz = aj2 * hrr_0110z;
                    fjkx -= 1 * trr_01x;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache2;
                    Ix = hrr_0100x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * hrr_1100x;
                    fiy = ai2 * trr_10y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    fkx = ak2 * hrr_0110x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * hrr_1110x;
                    fiky = ai2 * trr_11y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    fikz = ai2 * trr_21z;
                    fikz -= 1 * trr_01z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0200x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    fjz = aj2 * hrr_1100z;
                    fjx -= 1 * 1;
                    fkx = ak2 * hrr_0110x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * trr_11z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0210x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    fjkz = aj2 * hrr_1110z;
                    fjkx -= 1 * trr_01x;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = hrr_0100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * hrr_1100y;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * hrr_0110y;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_21x;
                    fiky = ai2 * hrr_1110y;
                    fikz = ai2 * trr_11z;
                    fikx -= 1 * trr_01x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    fjy = aj2 * hrr_0200y;
                    fjz = aj2 * hrr_0100z;
                    fjy -= 1 * 1;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * hrr_0110y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_1110x;
                    double hrr_0210y = hrr_1110y - yjyi * hrr_0110y;
                    fjky = aj2 * hrr_0210y;
                    fjkz = aj2 * hrr_0110z;
                    fjky -= 1 * trr_01y;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = hrr_1100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    double trr_30y = c0y * trr_20y + 2*b10 * trr_10y;
                    double hrr_2100y = trr_30y - yjyi * trr_20y;
                    fiy = ai2 * hrr_2100y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * hrr_0100y;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * hrr_1110y;
                    fkz = ak2 * trr_01z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    double trr_31y = cpy * trr_30y + 3*b00 * trr_20y;
                    double hrr_2110y = trr_31y - yjyi * trr_21y;
                    fiky = ai2 * hrr_2110y;
                    fikz = ai2 * trr_11z;
                    fiky -= 1 * hrr_0110y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    double hrr_1200y = hrr_2100y - yjyi * hrr_1100y;
                    fjy = aj2 * hrr_1200y;
                    fjz = aj2 * hrr_0100z;
                    fjy -= 1 * trr_10y;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * hrr_1110y;
                    fkz = ak2 * trr_01z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    double hrr_1210y = hrr_2110y - yjyi * hrr_1110y;
                    fjky = aj2 * hrr_1210y;
                    fjkz = aj2 * hrr_0110z;
                    fjky -= 1 * trr_11y;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = hrr_0100y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * hrr_1100y;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * hrr_0110y;
                    fkz = ak2 * trr_11z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * hrr_1110y;
                    fikz = ai2 * trr_21z;
                    fikz -= 1 * trr_01z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0200y;
                    fjz = aj2 * hrr_1100z;
                    fjy -= 1 * 1;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * hrr_0110y;
                    fkz = ak2 * trr_11z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_0210y;
                    fjkz = aj2 * hrr_1110z;
                    fjky -= 1 * trr_01y;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * hrr_1100z;
                    fix -= 1 * 1;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * hrr_0110z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_21x;
                    fiky = ai2 * trr_11y;
                    fikz = ai2 * hrr_1110z;
                    fikx -= 1 * trr_01x;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    fjz = aj2 * hrr_0200z;
                    fjz -= 1 * wt;
                    fkx = ak2 * trr_11x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * hrr_0110z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_1110x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_0210z = hrr_1110z - zjzi * hrr_0110z;
                    fjkz = aj2 * hrr_0210z;
                    fjkz -= 1 * trr_01z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * hrr_1100z;
                    fiy -= 1 * 1;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * hrr_0110z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_21y;
                    fikz = ai2 * hrr_1110z;
                    fiky -= 1 * trr_01y;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0200z;
                    fjz -= 1 * wt;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_11y;
                    fkz = ak2 * hrr_0110z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_1110y;
                    fjkz = aj2 * hrr_0210z;
                    fjkz -= 1 * trr_01z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = hrr_1100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    double trr_30z = c0z * trr_20z + 2*b10 * trr_10z;
                    double hrr_2100z = trr_30z - zjzi * trr_20z;
                    fiz = ai2 * hrr_2100z;
                    fiz -= 1 * hrr_0100z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * hrr_1110z;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    fikx = ai2 * trr_11x;
                    fiky = ai2 * trr_11y;
                    double trr_31z = cpz * trr_30z + 3*b00 * trr_20z;
                    double hrr_2110z = trr_31z - zjzi * trr_21z;
                    fikz = ai2 * hrr_2110z;
                    fikz -= 1 * hrr_0110z;
                    fikx *= ak2;
                    fiky *= ak2;
                    fikz *= ak2;
                    v_ixkx += fikx * prod_yz;
                    v_iyky += fiky * prod_xz;
                    v_izkz += fikz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1200z = hrr_2100z - zjzi * hrr_1100z;
                    fjz = aj2 * hrr_1200z;
                    fjz -= 1 * trr_10z;
                    fkx = ak2 * trr_01x;
                    fky = ak2 * trr_01y;
                    fkz = ak2 * hrr_1110z;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    fjkx = aj2 * hrr_0110x;
                    fjky = aj2 * hrr_0110y;
                    double hrr_1210z = hrr_2110z - zjzi * hrr_1110z;
                    fjkz = aj2 * hrr_1210z;
                    fjkz -= 1 * trr_11z;
                    fjkx *= ak2;
                    fjky *= ak2;
                    fjkz *= ak2;
                    v_jxkx += fjkx * prod_yz;
                    v_jyky += fjky * prod_xz;
                    v_jzkz += fjkz * prod_xy;
                    }
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    dd = dd_cache0;
                    Ix = hrr_1100x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double trr_30x = c0x * trr_20x + 2*b10 * trr_10x;
                    double hrr_2100x = trr_30x - xjxi * trr_20x;
                    fix = ai2 * hrr_2100x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    fiy = ai2 * trr_10y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    fiz = ai2 * trr_10z;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    fix -= 1 * hrr_0100x;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double b00 = .5 * rt_aa;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    double hrr_2001x = trr_21x - xlxk * trr_20x;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    double hrr_1101x = hrr_2001x - xjxi * hrr_1001x;
                    flx = al2 * hrr_1101x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    fly = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    double trr_31x = cpx * trr_30x + 3*b00 * trr_20x;
                    double hrr_3001x = trr_31x - xlxk * trr_30x;
                    double hrr_2101x = hrr_3001x - xjxi * hrr_2001x;
                    filx = ai2 * hrr_2101x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    fily = ai2 * hrr_1001y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    filz = ai2 * hrr_1001z;
                    double trr_01x = cpx * 1;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    double hrr_0101x = hrr_1001x - xjxi * hrr_0001x;
                    filx -= 1 * hrr_0101x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_1200x = hrr_2100x - xjxi * hrr_1100x;
                    fjx = aj2 * hrr_1200x;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    fjz = aj2 * hrr_0100z;
                    fjx -= 1 * trr_10x;
                    flx = al2 * hrr_1101x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_1201x = hrr_2101x - xjxi * hrr_1101x;
                    fjlx = aj2 * hrr_1201x;
                    double hrr_0101y = hrr_1001y - yjyi * hrr_0001y;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0101z = hrr_1001z - zjzi * hrr_0001z;
                    fjlz = aj2 * hrr_0101z;
                    fjlx -= 1 * hrr_1001x;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache1;
                    Ix = hrr_0100x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * hrr_1100x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * 1;
                    flx = al2 * hrr_0101x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1101x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    double hrr_2001y = trr_21y - ylyk * trr_20y;
                    fily = ai2 * hrr_2001y;
                    filz = ai2 * hrr_1001z;
                    fily -= 1 * hrr_0001y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    fjx = aj2 * hrr_0200x;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0100z;
                    fjx -= 1 * 1;
                    flx = al2 * hrr_0101x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    double hrr_0201x = hrr_1101x - xjxi * hrr_0101x;
                    fjlx = aj2 * hrr_0201x;
                    double hrr_1101y = hrr_2001y - yjyi * hrr_1001y;
                    fjly = aj2 * hrr_1101y;
                    fjlz = aj2 * hrr_0101z;
                    fjlx -= 1 * hrr_0001x;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache2;
                    Ix = hrr_0100x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * hrr_1100x;
                    fiy = ai2 * trr_10y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    flx = al2 * hrr_0101x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1101x;
                    fily = ai2 * hrr_1001y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    double hrr_2001z = trr_21z - zlzk * trr_20z;
                    filz = ai2 * hrr_2001z;
                    filz -= 1 * hrr_0001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0200x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    fjz = aj2 * hrr_1100z;
                    fjx -= 1 * 1;
                    flx = al2 * hrr_0101x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0201x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_1101z = hrr_2001z - zjzi * hrr_1001z;
                    fjlz = aj2 * hrr_1101z;
                    fjlx -= 1 * hrr_0001x;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = hrr_0100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * hrr_1100y;
                    fiz = ai2 * trr_10z;
                    fix -= 1 * 1;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0101y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_2001x;
                    fily = ai2 * hrr_1101y;
                    filz = ai2 * hrr_1001z;
                    filx -= 1 * hrr_0001x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    fjy = aj2 * hrr_0200y;
                    fjz = aj2 * hrr_0100z;
                    fjy -= 1 * 1;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0101y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_1101x;
                    double hrr_0201y = hrr_1101y - yjyi * hrr_0101y;
                    fjly = aj2 * hrr_0201y;
                    fjlz = aj2 * hrr_0101z;
                    fjly -= 1 * hrr_0001y;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = hrr_1100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    double trr_30y = c0y * trr_20y + 2*b10 * trr_10y;
                    double hrr_2100y = trr_30y - yjyi * trr_20y;
                    fiy = ai2 * hrr_2100y;
                    fiz = ai2 * trr_10z;
                    fiy -= 1 * hrr_0100y;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1101y;
                    flz = al2 * hrr_0001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    double trr_31y = cpy * trr_30y + 3*b00 * trr_20y;
                    double hrr_3001y = trr_31y - ylyk * trr_30y;
                    double hrr_2101y = hrr_3001y - yjyi * hrr_2001y;
                    fily = ai2 * hrr_2101y;
                    filz = ai2 * hrr_1001z;
                    fily -= 1 * hrr_0101y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    double hrr_1200y = hrr_2100y - yjyi * hrr_1100y;
                    fjy = aj2 * hrr_1200y;
                    fjz = aj2 * hrr_0100z;
                    fjy -= 1 * trr_10y;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1101y;
                    flz = al2 * hrr_0001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    double hrr_1201y = hrr_2101y - yjyi * hrr_1101y;
                    fjly = aj2 * hrr_1201y;
                    fjlz = aj2 * hrr_0101z;
                    fjly -= 1 * hrr_1001y;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = hrr_0100y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * hrr_1100y;
                    fiz = ai2 * trr_20z;
                    fiz -= 1 * wt;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0101y;
                    flz = al2 * hrr_1001z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_1101y;
                    filz = ai2 * hrr_2001z;
                    filz -= 1 * hrr_0001z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0200y;
                    fjz = aj2 * hrr_1100z;
                    fjy -= 1 * 1;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0101y;
                    flz = al2 * hrr_1001z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_0201y;
                    fjlz = aj2 * hrr_1101z;
                    fjly -= 1 * hrr_0001y;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_20x;
                    fiy = ai2 * trr_10y;
                    fiz = ai2 * hrr_1100z;
                    fix -= 1 * 1;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0101z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_2001x;
                    fily = ai2 * hrr_1001y;
                    filz = ai2 * hrr_1101z;
                    filx -= 1 * hrr_0001x;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_1100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    fjz = aj2 * hrr_0200z;
                    fjz -= 1 * wt;
                    flx = al2 * hrr_1001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_0101z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_1101x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_0201z = hrr_1101z - zjzi * hrr_0101z;
                    fjlz = aj2 * hrr_0201z;
                    fjlz -= 1 * hrr_0001z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_20y;
                    fiz = ai2 * hrr_1100z;
                    fiy -= 1 * 1;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0101z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_2001y;
                    filz = ai2 * hrr_1101z;
                    fily -= 1 * hrr_0001y;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_1100y;
                    fjz = aj2 * hrr_0200z;
                    fjz -= 1 * wt;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_1001y;
                    flz = al2 * hrr_0101z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_1101y;
                    fjlz = aj2 * hrr_0201z;
                    fjlz -= 1 * hrr_0001z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = hrr_1100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    fix = ai2 * trr_10x;
                    fiy = ai2 * trr_10y;
                    double trr_30z = c0z * trr_20z + 2*b10 * trr_10z;
                    double hrr_2100z = trr_30z - zjzi * trr_20z;
                    fiz = ai2 * hrr_2100z;
                    fiz -= 1 * hrr_0100z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1101z;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    filx = ai2 * hrr_1001x;
                    fily = ai2 * hrr_1001y;
                    double trr_31z = cpz * trr_30z + 3*b00 * trr_20z;
                    double hrr_3001z = trr_31z - zlzk * trr_30z;
                    double hrr_2101z = hrr_3001z - zjzi * hrr_2001z;
                    filz = ai2 * hrr_2101z;
                    filz -= 1 * hrr_0101z;
                    filx *= al2;
                    fily *= al2;
                    filz *= al2;
                    v_ixlx += filx * prod_yz;
                    v_iyly += fily * prod_xz;
                    v_izlz += filz * prod_xy;
                    fjx = aj2 * hrr_0100x;
                    fjy = aj2 * hrr_0100y;
                    double hrr_1200z = hrr_2100z - zjzi * hrr_1100z;
                    fjz = aj2 * hrr_1200z;
                    fjz -= 1 * trr_10z;
                    flx = al2 * hrr_0001x;
                    fly = al2 * hrr_0001y;
                    flz = al2 * hrr_1101z;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    fjlx = aj2 * hrr_0101x;
                    fjly = aj2 * hrr_0101y;
                    double hrr_1201z = hrr_2101z - zjzi * hrr_1101z;
                    fjlz = aj2 * hrr_1201z;
                    fjlz -= 1 * hrr_1001z;
                    fjlx *= al2;
                    fjly *= al2;
                    fjlz *= al2;
                    v_jxlx += fjlx * prod_yz;
                    v_jyly += fjly * prod_xz;
                    v_jzlz += fjlz * prod_xy;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1110(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 64;
    constexpr int gout_stride = 4;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 1728 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 60 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (60+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[64] = ylyk;
            rlrk[128] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double gix, giy, giz;
        double gjx, gjy, gjz;
        double gkx, gky, gkz;
        double glx, gly, glz;
        double gikx, giky, gikz;
        double gjkx, gjky, gjkz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[64];
                double zlzk = rlrk[128];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[64] * al_akl;
                double zkl = rk[2] + rlrk[128] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[64] = ypq;
                    Rpq[128] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1152] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*128];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 4) {
                        if (n == 2) {
                            gx[2304] = rw[irys*128+64];
                        }
                        double *_gx = gx + n * 1152;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*64];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[64] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[128] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 2 * b10 * s0;
                        _gx[192] = s2;
                        double xlxk = rlrk[n*64];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*64];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[384] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[768] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[448] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[384];
                        _gx[832] = s2;
                        s0 = _gx[128];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[64];
                        _gx[512] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[448];
                        _gx[896] = s2;
                        s0 = _gx[192];
                        s1 = cpx * s0;
                        s1 += 3 * b00 * _gx[128];
                        _gx[576] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 3 * b00 * _gx[512];
                        _gx[960] = s2;
                        s1 = _gx[192];
                        s0 = _gx[128];
                        _gx[320] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[256] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[192] = s1 - xjxi * s0;
                        s1 = _gx[576];
                        s0 = _gx[512];
                        _gx[704] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[448];
                        _gx[640] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[576] = s1 - xjxi * s0;
                        s1 = _gx[960];
                        s0 = _gx[896];
                        _gx[1088] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[832];
                        _gx[1024] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[768];
                        _gx[960] = s1 - xjxi * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[640];
                    Iy = gx[1152];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1216];
                    giz = gx[2368];
                    gkx = gx[1024];
                    gky = gx[1536];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx - 1 * gx[256];
                    fjx = aj2 * gjx - 1 * gx[448];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1088];
                    giky = gx[1600];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[960]) - 1 * (ai2 * gx[320] - 1 * gx[192])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[832]) - 1 * (aj2 * (gx[320] - xjxi * gx[256]) - 1 * gx[64])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[960] - xlxk * gx[576])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[832] - xlxk * gx[448])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[384];
                    Iy = gx[1408];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[448];
                    giy = gx[1472];
                    giz = gx[2368];
                    gkx = gx[768];
                    gky = gx[1792];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1216];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1856];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1728]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1600]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1728] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1600] - ylyk * gx[1216])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[384];
                    Iy = gx[1152];
                    Iz = gx[2560];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[448];
                    giy = gx[1216];
                    giz = gx[2624];
                    gkx = gx[768];
                    gky = gx[1536];
                    gkz = gx[2944];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2368];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1600];
                    gikz = gx[3008];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2880]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2752]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2880] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2752] - zlzk * gx[2368])) * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[64];
                    Iy = gx[1728];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1792];
                    giz = gx[2368];
                    gkx = gx[448];
                    gky = gx[2112];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1344];
                    fjy = aj2 * gjy - 1 * gx[1536];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[2176];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[384]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1408]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1920]) - 1 * (aj2 * (gx[1408] - yjyi * gx[1344]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1536])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1024];
                    Ix = gx[0];
                    Iy = gx[1600];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1664];
                    giz = gx[2560];
                    gkx = gx[384];
                    gky = gx[1984];
                    gkz = gx[2880];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1536];
                    fky = ak2 * gky - 1 * gx[1216];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[2048];
                    gikz = gx[2944];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1920]) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2688]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1536])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1280];
                    Ix = gx[192];
                    Iy = gx[1152];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1216];
                    giz = gx[2816];
                    gkx = gx[576];
                    gky = gx[1536];
                    gkz = gx[3136];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2688];
                    fkz = ak2 * gkz - 1 * gx[2368];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[640];
                    giky = gx[1600];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3072]) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[384]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2688])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1536];
                    Ix = gx[64];
                    Iy = gx[1152];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1216];
                    giz = gx[2944];
                    gkx = gx[448];
                    gky = gx[1536];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2496];
                    fjz = aj2 * gjz - 1 * gx[2688];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1600];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[384]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2560]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3072]) - 1 * (aj2 * (gx[2560] - zjzi * gx[2496]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2688])) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[64];
                    Ix = gx[576];
                    Iy = gx[1216];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1280];
                    giz = gx[2368];
                    gkx = gx[960];
                    gky = gx[1600];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[192];
                    fjx = aj2 * gjx - 1 * gx[384];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1664];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[256]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1536]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[768]) - 1 * (aj2 * (gx[256] - xjxi * gx[192]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[384])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[384];
                    Iy = gx[1344];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[448];
                    giy = gx[1408];
                    giz = gx[2432];
                    gkx = gx[768];
                    gky = gx[1728];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1792];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2688]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1536]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[256];
                    Iy = gx[1536];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1600];
                    giz = gx[2368];
                    gkx = gx[640];
                    gky = gx[1920];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[64];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[704];
                    giky = gx[1984];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[576]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[448]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[576] - xlxk * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[448] - xlxk * gx[64])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[0];
                    Iy = gx[1792];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1856];
                    giz = gx[2368];
                    gkx = gx[384];
                    gky = gx[2176];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky - 1 * gx[1408];
                    fjy = aj2 * gjy - 1 * gx[1600];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[2240];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[2112]) - 1 * (ai2 * gx[1472] - 1 * gx[1344])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1984]) - 1 * (aj2 * (gx[1472] - yjyi * gx[1408]) - 1 * gx[1216])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2112] - ylyk * gx[1728])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1984] - ylyk * gx[1600])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1088];
                    Ix = gx[0];
                    Iy = gx[1536];
                    Iz = gx[2560];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1600];
                    giz = gx[2624];
                    gkx = gx[384];
                    gky = gx[1920];
                    gkz = gx[2944];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2368];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1984];
                    gikz = gx[3008];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2880]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2752]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2880] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2752] - zlzk * gx[2368])) * prod_xy;
                    dd = dd_cache[1344];
                    Ix = gx[64];
                    Iy = gx[1344];
                    Iz = gx[2688];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1408];
                    giz = gx[2752];
                    gkx = gx[448];
                    gky = gx[1728];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1792];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[384]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1536]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1600];
                    Ix = gx[0];
                    Iy = gx[1216];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1280];
                    giz = gx[2944];
                    gkx = gx[384];
                    gky = gx[1600];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2496];
                    fjz = aj2 * gjz - 1 * gx[2688];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1664];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1536]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2560]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3072]) - 1 * (aj2 * (gx[2560] - zjzi * gx[2496]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2688])) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[128];
                    Ix = gx[576];
                    Iy = gx[1152];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1216];
                    giz = gx[2432];
                    gkx = gx[960];
                    gky = gx[1536];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[192];
                    fjx = aj2 * gjx - 1 * gx[384];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1600];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[256]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2688]) * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[768]) - 1 * (aj2 * (gx[256] - xjxi * gx[192]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[384])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[448];
                    Iy = gx[1152];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[512];
                    giy = gx[1216];
                    giz = gx[2560];
                    gkx = gx[832];
                    gky = gx[1536];
                    gkz = gx[2880];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[384];
                    fkx = ak2 * gkx - 1 * gx[64];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1600];
                    gikz = gx[2944];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[768]) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2688]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[384])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[192];
                    Iy = gx[1600];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1664];
                    giz = gx[2368];
                    gkx = gx[576];
                    gky = gx[1984];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1536];
                    fky = ak2 * gky - 1 * gx[1216];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[640];
                    giky = gx[2048];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1920]) - 1 * (ai2 * gx[1280] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[384]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1280] - yjyi * gx[1216])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1536])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[896];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1792];
                    giz = gx[2432];
                    gkx = gx[384];
                    gky = gx[2112];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1344];
                    fjy = aj2 * gjy - 1 * gx[1536];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[2176];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1408]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2688]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1920]) - 1 * (aj2 * (gx[1408] - yjyi * gx[1344]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1536])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1152];
                    Ix = gx[256];
                    Iy = gx[1152];
                    Iz = gx[2688];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1216];
                    giz = gx[2752];
                    gkx = gx[640];
                    gky = gx[1536];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[64];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[704];
                    giky = gx[1600];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[576]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[448]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[576] - xlxk * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[448] - xlxk * gx[64])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1408];
                    Ix = gx[0];
                    Iy = gx[1408];
                    Iz = gx[2688];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1472];
                    giz = gx[2752];
                    gkx = gx[384];
                    gky = gx[1792];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1216];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1856];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1728]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1600]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1728] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1600] - ylyk * gx[1216])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1664];
                    Ix = gx[0];
                    Iy = gx[1152];
                    Iz = gx[2944];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1216];
                    giz = gx[3008];
                    gkx = gx[384];
                    gky = gx[1536];
                    gkz = gx[3328];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz - 1 * gx[2560];
                    fjz = aj2 * gjz - 1 * gx[2752];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1600];
                    gikz = gx[3392];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3264]) - 1 * (ai2 * gx[2624] - 1 * gx[2496])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3136]) - 1 * (aj2 * (gx[2624] - zjzi * gx[2560]) - 1 * gx[2368])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3264] - zlzk * gx[2880])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3136] - zlzk * gx[2752])) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[192];
                    Ix = gx[448];
                    Iy = gx[1344];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[512];
                    giy = gx[1408];
                    giz = gx[2368];
                    gkx = gx[832];
                    gky = gx[1728];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[384];
                    fkx = ak2 * gkx - 1 * gx[64];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1792];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[768]) - 1 * (ai2 * gx[128] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[128] - xjxi * gx[64])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1536]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[384])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[384];
                    Iy = gx[1216];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[448];
                    giy = gx[1280];
                    giz = gx[2560];
                    gkx = gx[768];
                    gky = gx[1600];
                    gkz = gx[2880];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1664];
                    gikz = gx[2944];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[64]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1536]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2688]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[192];
                    Iy = gx[1536];
                    Iz = gx[2368];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1600];
                    giz = gx[2432];
                    gkx = gx[576];
                    gky = gx[1920];
                    gkz = gx[2752];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[640];
                    giky = gx[1984];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2688]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[384]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[960];
                    Ix = gx[64];
                    Iy = gx[1536];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1600];
                    giz = gx[2560];
                    gkx = gx[448];
                    gky = gx[1920];
                    gkz = gx[2880];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1984];
                    gikz = gx[2944];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[384]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1216]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2688]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1216];
                    Ix = gx[192];
                    Iy = gx[1216];
                    Iz = gx[2688];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1280];
                    giz = gx[2752];
                    gkx = gx[576];
                    gky = gx[1600];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[640];
                    giky = gx[1664];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1536]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2368]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[384]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1472];
                    Ix = gx[0];
                    Iy = gx[1344];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1408];
                    giz = gx[2816];
                    gkx = gx[384];
                    gky = gx[1728];
                    gkz = gx[3136];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2688];
                    fkz = ak2 * gkz - 1 * gx[2368];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1792];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3072]) - 1 * (ai2 * gx[2432] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1536]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2432] - zjzi * gx[2368])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2688])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type3_1111(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 32;
    constexpr int gout_stride = 8;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 2592 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 114 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (114+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[32] = ylyk;
            rlrk[64] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double gix, giy, giz;
        double gjx, gjy, gjz;
        double gkx, gky, gkz;
        double glx, gly, glz;
        double gikx, giky, gikz;
        double gjkx, gjky, gjkz;
        double fix, fiy, fiz;
        double fjx, fjy, fjz;
        double fkx, fky, fkz;
        double flx, fly, flz;
        double v_ixkx = 0;
        double v_ixky = 0;
        double v_ixkz = 0;
        double v_iykx = 0;
        double v_iyky = 0;
        double v_iykz = 0;
        double v_izkx = 0;
        double v_izky = 0;
        double v_izkz = 0;
        double v_jxkx = 0;
        double v_jxky = 0;
        double v_jxkz = 0;
        double v_jykx = 0;
        double v_jyky = 0;
        double v_jykz = 0;
        double v_jzkx = 0;
        double v_jzky = 0;
        double v_jzkz = 0;
        double v_ixlx = 0;
        double v_ixly = 0;
        double v_ixlz = 0;
        double v_iylx = 0;
        double v_iyly = 0;
        double v_iylz = 0;
        double v_izlx = 0;
        double v_izly = 0;
        double v_izlz = 0;
        double v_jxlx = 0;
        double v_jxly = 0;
        double v_jxlz = 0;
        double v_jylx = 0;
        double v_jyly = 0;
        double v_jylz = 0;
        double v_jzlx = 0;
        double v_jzly = 0;
        double v_jzlz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 81; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 81; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[32];
                double zlzk = rlrk[64];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[32] * al_akl;
                double zkl = rk[2] + rlrk[64] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[32] = ypq;
                    Rpq[64] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1152] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*64];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 8) {
                        if (n == 2) {
                            gx[2304] = rw[irys*64+32];
                        }
                        double *_gx = gx + n * 1152;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[32] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[64] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 2 * b10 * s0;
                        _gx[96] = s2;
                        double xlxk = rlrk[n*32];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[192] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[384] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        _gx[576] = s2;
                        s0 = _gx[32];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[224] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[192];
                        _gx[416] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 1 * b00 * _gx[384];
                        _gx[608] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[32];
                        _gx[256] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[224];
                        _gx[448] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 2 * b00 * _gx[416];
                        _gx[640] = s2;
                        s0 = _gx[96];
                        s1 = cpx * s0;
                        s1 += 3 * b00 * _gx[64];
                        _gx[288] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 3 * b00 * _gx[256];
                        _gx[480] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 3 * b00 * _gx[448];
                        _gx[672] = s2;
                        s1 = _gx[96];
                        s0 = _gx[64];
                        _gx[160] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[128] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[96] = s1 - xjxi * s0;
                        s1 = _gx[288];
                        s0 = _gx[256];
                        _gx[352] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[320] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[288] = s1 - xjxi * s0;
                        s1 = _gx[480];
                        s0 = _gx[448];
                        _gx[544] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[512] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[480] = s1 - xjxi * s0;
                        s1 = _gx[672];
                        s0 = _gx[640];
                        _gx[736] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[704] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[672] = s1 - xjxi * s0;
                        s1 = _gx[576];
                        s0 = _gx[384];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[768] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[576] = s1 - xlxk * s0;
                        s1 = _gx[608];
                        s0 = _gx[416];
                        _gx[992] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[800] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[608] = s1 - xlxk * s0;
                        s1 = _gx[640];
                        s0 = _gx[448];
                        _gx[1024] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[256];
                        _gx[832] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[640] = s1 - xlxk * s0;
                        s1 = _gx[672];
                        s0 = _gx[480];
                        _gx[1056] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[864] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[96];
                        _gx[672] = s1 - xlxk * s0;
                        s1 = _gx[704];
                        s0 = _gx[512];
                        _gx[1088] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[704] = s1 - xlxk * s0;
                        s1 = _gx[736];
                        s0 = _gx[544];
                        _gx[1120] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[928] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[160];
                        _gx[736] = s1 - xlxk * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[896];
                    Iy = gx[1152];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[928];
                    giy = gx[1184];
                    giz = gx[2336];
                    gkx = gx[1088];
                    gky = gx[1344];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[864];
                    fkx = ak2 * gkx - 1 * gx[704];
                    fjx = aj2 * gjx - 1 * gx[800];
                    flx = al2 * glx - 1 * gx[320];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1120];
                    giky = gx[1376];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[1056]) - 1 * (ai2 * gx[736] - 1 * gx[672])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[992]) - 1 * (aj2 * (gx[736] - xjxi * gx[704]) - 1 * gx[608])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[1056] - xlxk * gx[864])) - 1 * (ai2 * gx[352] - 1 * gx[288])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[992] - xlxk * gx[800])) - 1 * (aj2 * (gx[352] - xjxi * gx[320]) - 1 * gx[224])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[768];
                    Iy = gx[1152];
                    Iz = gx[2432];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[800];
                    giy = gx[1184];
                    giz = gx[2464];
                    gkx = gx[960];
                    gky = gx[1344];
                    gkz = gx[2624];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2400];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2336];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[992];
                    giky = gx[1376];
                    gikz = gx[2656];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[608]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2592]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[608] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2528]) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[224]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2592] - zlzk * gx[2400])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[224] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2528] - zlzk * gx[2336])) * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[576];
                    Iy = gx[1376];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1408];
                    giz = gx[2432];
                    gkx = gx[768];
                    gky = gx[1568];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1184];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1600];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[608];
                    Iy = gx[1152];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1184];
                    giz = gx[2624];
                    gkx = gx[800];
                    gky = gx[1344];
                    gkz = gx[2784];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[32];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2400];
                    fjz = aj2 * gjz - 1 * gx[2496];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1376];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2688]) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    dd = dd_cache[1024];
                    Ix = gx[192];
                    Iy = gx[1824];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1856];
                    giz = gx[2368];
                    gkx = gx[384];
                    gky = gx[2016];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1728];
                    fly = al2 * gly - 1 * gx[1248];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[2048];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1920]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1280];
                    Ix = gx[0];
                    Iy = gx[2048];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[2080];
                    giz = gx[2336];
                    gkx = gx[192];
                    gky = gx[2240];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[2016];
                    fky = ak2 * gky - 1 * gx[1856];
                    fjy = aj2 * gjy - 1 * gx[1952];
                    fly = al2 * gly - 1 * gx[1472];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2272];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[2208]) - 1 * (ai2 * gx[1888] - 1 * gx[1824])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[2144]) - 1 * (aj2 * (gx[1888] - yjyi * gx[1856]) - 1 * gx[1760])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2208] - ylyk * gx[2016])) - 1 * (ai2 * gx[1504] - 1 * gx[1440])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[2144] - ylyk * gx[1952])) - 1 * (aj2 * (gx[1504] - yjyi * gx[1472]) - 1 * gx[1376])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1536];
                    Ix = gx[32];
                    Iy = gx[1824];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1856];
                    giz = gx[2528];
                    gkx = gx[224];
                    gky = gx[2016];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1728];
                    fly = al2 * gly - 1 * gx[1248];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2048];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1920]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1792];
                    Ix = gx[288];
                    Iy = gx[1152];
                    Iz = gx[2912];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1184];
                    giz = gx[2944];
                    gkx = gx[480];
                    gky = gx[1344];
                    gkz = gx[3104];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[96];
                    fjx = aj2 * gjx - 1 * gx[192];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2336];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1376];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[384]) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    dd = dd_cache[2048];
                    Ix = gx[96];
                    Iy = gx[1376];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1408];
                    giz = gx[2912];
                    gkx = gx[288];
                    gky = gx[1568];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1184];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1600];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2304];
                    Ix = gx[128];
                    Iy = gx[1152];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[160];
                    giy = gx[1184];
                    giz = gx[3104];
                    gkx = gx[320];
                    gky = gx[1344];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[96];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[32];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[352];
                    giky = gx[1376];
                    gikz = gx[3296];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[288]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2912]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[224]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2912] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[288] - xlxk * gx[96])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2528]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[224] - xlxk * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2528] - zjzi * gx[2496])) * prod_xy;
                    dd = dd_cache[2560];
                    Ix = gx[0];
                    Iy = gx[1152];
                    Iz = gx[3200];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1184];
                    giz = gx[3232];
                    gkx = gx[192];
                    gky = gx[1344];
                    gkz = gx[3392];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[3168];
                    fkz = ak2 * gkz - 1 * gx[3008];
                    fjz = aj2 * gjz - 1 * gx[3104];
                    flz = al2 * glz - 1 * gx[2624];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1376];
                    gikz = gx[3424];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3360]) - 1 * (ai2 * gx[3040] - 1 * gx[2976])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3296]) - 1 * (aj2 * (gx[3040] - zjzi * gx[3008]) - 1 * gx[2912])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3360] - zlzk * gx[3168])) - 1 * (ai2 * gx[2656] - 1 * gx[2592])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3296] - zlzk * gx[3104])) - 1 * (aj2 * (gx[2656] - zjzi * gx[2624]) - 1 * gx[2528])) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[32];
                    Ix = gx[864];
                    Iy = gx[1184];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[896];
                    giy = gx[1216];
                    giz = gx[2336];
                    gkx = gx[1056];
                    gky = gx[1376];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[672];
                    fjx = aj2 * gjx - 1 * gx[768];
                    flx = al2 * glx - 1 * gx[288];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1088];
                    giky = gx[1408];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[704]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[960]) - 1 * (aj2 * (gx[704] - xjxi * gx[672]) - 1 * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[320]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[960] - xlxk * gx[768])) - 1 * (aj2 * (gx[320] - xjxi * gx[288]) - 1 * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[288];
                    Ix = gx[704];
                    Iy = gx[1344];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[736];
                    giy = gx[1376];
                    giz = gx[2336];
                    gkx = gx[896];
                    gky = gx[1536];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[672];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[608];
                    flx = al2 * glx - 1 * gx[128];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[928];
                    giky = gx[1568];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[864]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[800]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[864] - xlxk * gx[672])) - 1 * (ai2 * gx[160] - 1 * gx[96])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[800] - xlxk * gx[608])) - 1 * (aj2 * (gx[160] - xjxi * gx[128]) - 1 * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[544];
                    Ix = gx[576];
                    Iy = gx[1344];
                    Iz = gx[2432];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1376];
                    giz = gx[2464];
                    gkx = gx[768];
                    gky = gx[1536];
                    gkz = gx[2624];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2400];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2336];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1568];
                    gikz = gx[2656];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2592]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2528]) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2592] - zlzk * gx[2400])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2528] - zlzk * gx[2336])) * prod_xy;
                    dd = dd_cache[800];
                    Ix = gx[576];
                    Iy = gx[1184];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1216];
                    giz = gx[2624];
                    gkx = gx[768];
                    gky = gx[1376];
                    gkz = gx[2784];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2400];
                    fjz = aj2 * gjz - 1 * gx[2496];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1408];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2688]) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    dd = dd_cache[1056];
                    Ix = gx[224];
                    Iy = gx[1728];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1760];
                    giz = gx[2432];
                    gkx = gx[416];
                    gky = gx[1920];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[32];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1952];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1312];
                    Ix = gx[0];
                    Iy = gx[2016];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[2048];
                    giz = gx[2368];
                    gkx = gx[192];
                    gky = gx[2208];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1824];
                    fjy = aj2 * gjy - 1 * gx[1920];
                    fly = al2 * gly - 1 * gx[1440];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2240];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1856]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[2112]) - 1 * (aj2 * (gx[1856] - yjyi * gx[1824]) - 1 * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1472]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[2112] - ylyk * gx[1920])) - 1 * (aj2 * (gx[1472] - yjyi * gx[1440]) - 1 * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1568];
                    Ix = gx[0];
                    Iy = gx[1856];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1888];
                    giz = gx[2528];
                    gkx = gx[192];
                    gky = gx[2048];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1824];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1760];
                    fly = al2 * gly - 1 * gx[1280];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2080];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[2016]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1952]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2016] - ylyk * gx[1824])) - 1 * (ai2 * gx[1312] - 1 * gx[1248])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1952] - ylyk * gx[1760])) - 1 * (aj2 * (gx[1312] - yjyi * gx[1280]) - 1 * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1824];
                    Ix = gx[224];
                    Iy = gx[1248];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1280];
                    giz = gx[2912];
                    gkx = gx[416];
                    gky = gx[1440];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[32];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1472];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2080];
                    Ix = gx[96];
                    Iy = gx[1344];
                    Iz = gx[2912];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1376];
                    giz = gx[2944];
                    gkx = gx[288];
                    gky = gx[1536];
                    gkz = gx[3104];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2336];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1568];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    dd = dd_cache[2336];
                    Ix = gx[96];
                    Iy = gx[1184];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1216];
                    giz = gx[3104];
                    gkx = gx[288];
                    gky = gx[1376];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1408];
                    gikz = gx[3296];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2912]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2912] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2528]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2528] - zjzi * gx[2496])) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[64];
                    Ix = gx[864];
                    Iy = gx[1152];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[896];
                    giy = gx[1184];
                    giz = gx[2368];
                    gkx = gx[1056];
                    gky = gx[1344];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[672];
                    fjx = aj2 * gjx - 1 * gx[768];
                    flx = al2 * glx - 1 * gx[288];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1088];
                    giky = gx[1376];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[704]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[960]) - 1 * (aj2 * (gx[704] - xjxi * gx[672]) - 1 * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[320]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[960] - xlxk * gx[768])) - 1 * (aj2 * (gx[320] - xjxi * gx[288]) - 1 * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[672];
                    Iy = gx[1376];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1408];
                    giz = gx[2336];
                    gkx = gx[864];
                    gky = gx[1568];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[576];
                    flx = al2 * glx - 1 * gx[96];
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1184];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1600];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[768]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[704];
                    Iy = gx[1152];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[736];
                    giy = gx[1184];
                    giz = gx[2528];
                    gkx = gx[896];
                    gky = gx[1344];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[672];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[608];
                    flx = al2 * glx - 1 * gx[128];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[928];
                    giky = gx[1376];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[864]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[800]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[864] - xlxk * gx[672])) - 1 * (ai2 * gx[160] - 1 * gx[96])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[800] - xlxk * gx[608])) - 1 * (aj2 * (gx[160] - xjxi * gx[128]) - 1 * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[576];
                    Iy = gx[1152];
                    Iz = gx[2624];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1184];
                    giz = gx[2656];
                    gkx = gx[768];
                    gky = gx[1344];
                    gkz = gx[2816];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2592];
                    fkz = ak2 * gkz - 1 * gx[2432];
                    fjz = aj2 * gjz - 1 * gx[2528];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1376];
                    gikz = gx[2848];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2784]) - 1 * (ai2 * gx[2464] - 1 * gx[2400])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2720]) - 1 * (aj2 * (gx[2464] - zjzi * gx[2432]) - 1 * gx[2336])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2784] - zlzk * gx[2592])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2720] - zlzk * gx[2528])) * prod_xy;
                    dd = dd_cache[1088];
                    Ix = gx[192];
                    Iy = gx[1760];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1792];
                    giz = gx[2432];
                    gkx = gx[384];
                    gky = gx[1952];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1184];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1984];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1344];
                    Ix = gx[32];
                    Iy = gx[1920];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1952];
                    giz = gx[2432];
                    gkx = gx[224];
                    gky = gx[2112];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2144];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1760]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1760] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1376]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1376] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1600];
                    Ix = gx[0];
                    Iy = gx[1824];
                    Iz = gx[2528];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1856];
                    giz = gx[2560];
                    gkx = gx[192];
                    gky = gx[2016];
                    gkz = gx[2720];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1728];
                    fly = al2 * gly - 1 * gx[1248];
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2336];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2048];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1920]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1856];
                    Ix = gx[192];
                    Iy = gx[1280];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1312];
                    giz = gx[2912];
                    gkx = gx[384];
                    gky = gx[1472];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1248];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1184];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1504];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1440]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1376]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1440] - ylyk * gx[1248])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1376] - ylyk * gx[1184])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2112];
                    Ix = gx[32];
                    Iy = gx[1440];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1472];
                    giz = gx[2912];
                    gkx = gx[224];
                    gky = gx[1632];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1248];
                    fjy = aj2 * gjy - 1 * gx[1344];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1664];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1536]) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2368];
                    Ix = gx[96];
                    Iy = gx[1152];
                    Iz = gx[3104];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1184];
                    giz = gx[3136];
                    gkx = gx[288];
                    gky = gx[1344];
                    gkz = gx[3296];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[3072];
                    fkz = ak2 * gkz - 1 * gx[2912];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2528];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1376];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3264]) - 1 * (ai2 * gx[2944] - 1 * gx[2880])) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2944] - zjzi * gx[2912])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3264] - zlzk * gx[3072])) - 1 * (ai2 * gx[2560] - 1 * gx[2496])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2560] - zjzi * gx[2528])) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[96];
                    Ix = gx[800];
                    Iy = gx[1248];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[832];
                    giy = gx[1280];
                    giz = gx[2336];
                    gkx = gx[992];
                    gky = gx[1440];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[768];
                    fkx = ak2 * gkx - 1 * gx[608];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[224];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1472];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[960]) - 1 * (ai2 * gx[640] - 1 * gx[576])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[640] - xjxi * gx[608])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[960] - xlxk * gx[768])) - 1 * (ai2 * gx[256] - 1 * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[256] - xjxi * gx[224])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[352];
                    Ix = gx[672];
                    Iy = gx[1344];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1376];
                    giz = gx[2368];
                    gkx = gx[864];
                    gky = gx[1536];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[576];
                    flx = al2 * glx - 1 * gx[96];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1568];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[768]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[608];
                    Ix = gx[672];
                    Iy = gx[1184];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1216];
                    giz = gx[2528];
                    gkx = gx[864];
                    gky = gx[1376];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[576];
                    flx = al2 * glx - 1 * gx[96];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1408];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[768]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[864];
                    Ix = gx[320];
                    Iy = gx[1728];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[352];
                    giy = gx[1760];
                    giz = gx[2336];
                    gkx = gx[512];
                    gky = gx[1920];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[288];
                    fkx = ak2 * gkx - 1 * gx[128];
                    fjx = aj2 * gjx - 1 * gx[224];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[544];
                    giky = gx[1952];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[480]) - 1 * (ai2 * gx[160] - 1 * gx[96])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[416]) - 1 * (aj2 * (gx[160] - xjxi * gx[128]) - 1 * gx[32])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[480] - xlxk * gx[288])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[416] - xlxk * gx[224])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1120];
                    Ix = gx[192];
                    Iy = gx[1728];
                    Iz = gx[2432];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1760];
                    giz = gx[2464];
                    gkx = gx[384];
                    gky = gx[1920];
                    gkz = gx[2624];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2400];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2336];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1952];
                    gikz = gx[2656];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2592]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2528]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2592] - zlzk * gx[2400])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2528] - zlzk * gx[2336])) * prod_xy;
                    dd = dd_cache[1376];
                    Ix = gx[0];
                    Iy = gx[1952];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1984];
                    giz = gx[2432];
                    gkx = gx[192];
                    gky = gx[2144];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1920];
                    fky = ak2 * gky - 1 * gx[1760];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1376];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2176];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[2112]) - 1 * (ai2 * gx[1792] - 1 * gx[1728])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1792] - yjyi * gx[1760])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2112] - ylyk * gx[1920])) - 1 * (ai2 * gx[1408] - 1 * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1408] - yjyi * gx[1376])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[1632];
                    Ix = gx[32];
                    Iy = gx[1728];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1760];
                    giz = gx[2624];
                    gkx = gx[224];
                    gky = gx[1920];
                    gkz = gx[2784];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2400];
                    fjz = aj2 * gjz - 1 * gx[2496];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1952];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2688]) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    dd = dd_cache[1888];
                    Ix = gx[192];
                    Iy = gx[1248];
                    Iz = gx[2912];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1280];
                    giz = gx[2944];
                    gkx = gx[384];
                    gky = gx[1440];
                    gkz = gx[3104];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2336];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1472];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    dd = dd_cache[2144];
                    Ix = gx[0];
                    Iy = gx[1472];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1504];
                    giz = gx[2912];
                    gkx = gx[192];
                    gky = gx[1664];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1440];
                    fky = ak2 * gky - 1 * gx[1280];
                    fjy = aj2 * gjy - 1 * gx[1376];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1696];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1632]) - 1 * (ai2 * gx[1312] - 1 * gx[1248])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1568]) - 1 * (aj2 * (gx[1312] - yjyi * gx[1280]) - 1 * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1632] - ylyk * gx[1440])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1568] - ylyk * gx[1376])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2400];
                    Ix = gx[32];
                    Iy = gx[1248];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1280];
                    giz = gx[3104];
                    gkx = gx[224];
                    gky = gx[1440];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1472];
                    gikz = gx[3296];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2912]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2912] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2528]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2528] - zjzi * gx[2496])) * prod_xy;
                    break;
                    case 4:
                    dd = dd_cache[128];
                    Ix = gx[768];
                    Iy = gx[1280];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[800];
                    giy = gx[1312];
                    giz = gx[2336];
                    gkx = gx[960];
                    gky = gx[1472];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy - 1 * gx[1248];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1184];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[992];
                    giky = gx[1504];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[608]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1440]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[608] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1376]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[224]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1440] - ylyk * gx[1248])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[224] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1376] - ylyk * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[608];
                    Iy = gx[1440];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1472];
                    giz = gx[2336];
                    gkx = gx[800];
                    gky = gx[1632];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[32];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1248];
                    fjy = aj2 * gjy - 1 * gx[1344];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1664];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1536]) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[672];
                    Iy = gx[1152];
                    Iz = gx[2528];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[704];
                    giy = gx[1184];
                    giz = gx[2560];
                    gkx = gx[864];
                    gky = gx[1344];
                    gkz = gx[2720];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[576];
                    flx = al2 * glx - 1 * gx[96];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2336];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[896];
                    giky = gx[1376];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[768]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += (al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[896];
                    Ix = gx[288];
                    Iy = gx[1760];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1792];
                    giz = gx[2336];
                    gkx = gx[480];
                    gky = gx[1952];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[96];
                    fjx = aj2 * gjx - 1 * gx[192];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1184];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1984];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[384]) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1152];
                    Ix = gx[128];
                    Iy = gx[1920];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[160];
                    giy = gx[1952];
                    giz = gx[2336];
                    gkx = gx[320];
                    gky = gx[2112];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[96];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[32];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[352];
                    giky = gx[2144];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[288]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1760]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[224]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1760] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[288] - xlxk * gx[96])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1376]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[224] - xlxk * gx[32])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1376] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1408];
                    Ix = gx[0];
                    Iy = gx[1920];
                    Iz = gx[2432];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1952];
                    giz = gx[2464];
                    gkx = gx[192];
                    gky = gx[2112];
                    gkz = gx[2624];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz - 1 * gx[2400];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2336];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[2144];
                    gikz = gx[2656];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1760]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2592]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1760] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2528]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1376]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2592] - zlzk * gx[2400])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1376] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2528] - zlzk * gx[2336])) * prod_xy;
                    dd = dd_cache[1664];
                    Ix = gx[0];
                    Iy = gx[1760];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1792];
                    giz = gx[2624];
                    gkx = gx[192];
                    gky = gx[1952];
                    gkz = gx[2784];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1184];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2400];
                    fjz = aj2 * gjz - 1 * gx[2496];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1984];
                    gikz = gx[2816];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2688]) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    dd = dd_cache[1920];
                    Ix = gx[224];
                    Iy = gx[1152];
                    Iz = gx[2976];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1184];
                    giz = gx[3008];
                    gkx = gx[416];
                    gky = gx[1344];
                    gkz = gx[3168];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[32];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2880];
                    flz = al2 * glz - 1 * gx[2400];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[1376];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3072]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    dd = dd_cache[2176];
                    Ix = gx[0];
                    Iy = gx[1440];
                    Iz = gx[2912];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1472];
                    giz = gx[2944];
                    gkx = gx[192];
                    gky = gx[1632];
                    gkz = gx[3104];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1248];
                    fjy = aj2 * gjy - 1 * gx[1344];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2880];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2336];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1664];
                    gikz = gx[3136];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3072]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1536]) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    dd = dd_cache[2432];
                    Ix = gx[0];
                    Iy = gx[1280];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1312];
                    giz = gx[3104];
                    gkx = gx[192];
                    gky = gx[1472];
                    gkz = gx[3264];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1248];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1184];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2880];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2496];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1504];
                    gikz = gx[3296];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1440]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2912]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1376]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2912] - zjzi * gx[2880])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1440] - ylyk * gx[1248])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2528]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1376] - ylyk * gx[1184])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2528] - zjzi * gx[2496])) * prod_xy;
                    break;
                    case 5:
                    dd = dd_cache[160];
                    Ix = gx[768];
                    Iy = gx[1248];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[800];
                    giy = gx[1280];
                    giz = gx[2368];
                    gkx = gx[960];
                    gky = gx[1440];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[992];
                    giky = gx[1472];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[608]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[608] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[224]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[224] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[416];
                    Ix = gx[576];
                    Iy = gx[1472];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1504];
                    giz = gx[2336];
                    gkx = gx[768];
                    gky = gx[1664];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1440];
                    fky = ak2 * gky - 1 * gx[1280];
                    fjy = aj2 * gjy - 1 * gx[1376];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1696];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1632]) - 1 * (ai2 * gx[1312] - 1 * gx[1248])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1568]) - 1 * (aj2 * (gx[1312] - yjyi * gx[1280]) - 1 * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1632] - ylyk * gx[1440])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1568] - ylyk * gx[1376])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[672];
                    Ix = gx[608];
                    Iy = gx[1248];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1280];
                    giz = gx[2528];
                    gkx = gx[800];
                    gky = gx[1440];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[32];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1472];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[928];
                    Ix = gx[288];
                    Iy = gx[1728];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1760];
                    giz = gx[2368];
                    gkx = gx[480];
                    gky = gx[1920];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[96];
                    fjx = aj2 * gjx - 1 * gx[192];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1952];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[384]) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1184];
                    Ix = gx[96];
                    Iy = gx[1952];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1984];
                    giz = gx[2336];
                    gkx = gx[288];
                    gky = gx[2144];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1920];
                    fky = ak2 * gky - 1 * gx[1760];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1376];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[2176];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[2112]) - 1 * (ai2 * gx[1792] - 1 * gx[1728])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1792] - yjyi * gx[1760])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2112] - ylyk * gx[1920])) - 1 * (ai2 * gx[1408] - 1 * gx[1344])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1408] - yjyi * gx[1376])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1440];
                    Ix = gx[128];
                    Iy = gx[1728];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[160];
                    giy = gx[1760];
                    giz = gx[2528];
                    gkx = gx[320];
                    gky = gx[1920];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[96];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[32];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[352];
                    giky = gx[1952];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[288]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[224]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[288] - xlxk * gx[96])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[224] - xlxk * gx[32])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1696];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[2624];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1760];
                    giz = gx[2656];
                    gkx = gx[192];
                    gky = gx[1920];
                    gkz = gx[2816];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2592];
                    fkz = ak2 * gkz - 1 * gx[2432];
                    fjz = aj2 * gjz - 1 * gx[2528];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1952];
                    gikz = gx[2848];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2784]) - 1 * (ai2 * gx[2464] - 1 * gx[2400])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[2720]) - 1 * (aj2 * (gx[2464] - zjzi * gx[2432]) - 1 * gx[2336])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2784] - zlzk * gx[2592])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2720] - zlzk * gx[2528])) * prod_xy;
                    dd = dd_cache[1952];
                    Ix = gx[192];
                    Iy = gx[1184];
                    Iz = gx[2976];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1216];
                    giz = gx[3008];
                    gkx = gx[384];
                    gky = gx[1376];
                    gkz = gx[3168];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2880];
                    flz = al2 * glz - 1 * gx[2400];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1408];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3072]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    dd = dd_cache[2208];
                    Ix = gx[32];
                    Iy = gx[1344];
                    Iz = gx[2976];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1376];
                    giz = gx[3008];
                    gkx = gx[224];
                    gky = gx[1536];
                    gkz = gx[3168];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2880];
                    flz = al2 * glz - 1 * gx[2400];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1568];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3072]) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    dd = dd_cache[2464];
                    Ix = gx[0];
                    Iy = gx[1248];
                    Iz = gx[3104];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1280];
                    giz = gx[3136];
                    gkx = gx[192];
                    gky = gx[1440];
                    gkz = gx[3296];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[3072];
                    fkz = ak2 * gkz - 1 * gx[2912];
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2528];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1472];
                    gikz = gx[3328];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[3264]) - 1 * (ai2 * gx[2944] - 1 * gx[2880])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2944] - zjzi * gx[2912])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3264] - zlzk * gx[3072])) - 1 * (ai2 * gx[2560] - 1 * gx[2496])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2560] - zjzi * gx[2528])) * prod_xy;
                    break;
                    case 6:
                    dd = dd_cache[192];
                    Ix = gx[800];
                    Iy = gx[1152];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[832];
                    giy = gx[1184];
                    giz = gx[2432];
                    gkx = gx[992];
                    gky = gx[1344];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[768];
                    fkx = ak2 * gkx - 1 * gx[608];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[224];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[1024];
                    giky = gx[1376];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[960]) - 1 * (ai2 * gx[640] - 1 * gx[576])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[640] - xjxi * gx[608])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[960] - xlxk * gx[768])) - 1 * (ai2 * gx[256] - 1 * gx[192])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[256] - xjxi * gx[224])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[576];
                    Iy = gx[1440];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1472];
                    giz = gx[2368];
                    gkx = gx[768];
                    gky = gx[1632];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1248];
                    fjy = aj2 * gjy - 1 * gx[1344];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1664];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[1536]) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[576];
                    Iy = gx[1280];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1312];
                    giz = gx[2528];
                    gkx = gx[768];
                    gky = gx[1472];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy - 1 * gx[1248];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1184];
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1504];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1440]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1376]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1440] - ylyk * gx[1248])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1376] - ylyk * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[960];
                    Ix = gx[224];
                    Iy = gx[1824];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[256];
                    giy = gx[1856];
                    giz = gx[2336];
                    gkx = gx[416];
                    gky = gx[2016];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[192];
                    fkx = ak2 * gkx - 1 * gx[32];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1728];
                    fly = al2 * gly - 1 * gx[1248];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[448];
                    giky = gx[2048];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[384]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1920]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1280]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (aj2 * (gx[1280] - yjyi * gx[1248]) - 1 * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1216];
                    Ix = gx[96];
                    Iy = gx[1920];
                    Iz = gx[2336];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1952];
                    giz = gx[2368];
                    gkx = gx[288];
                    gky = gx[2112];
                    gkz = gx[2528];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1728];
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1344];
                    fiz = ai2 * giz - 1 * gx[2304];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[2144];
                    gikz = gx[2560];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1760]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[2496]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1760] - yjyi * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1376]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1376] - yjyi * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1472];
                    Ix = gx[96];
                    Iy = gx[1760];
                    Iz = gx[2496];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1792];
                    giz = gx[2528];
                    gkx = gx[288];
                    gky = gx[1952];
                    gkz = gx[2688];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1728];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1184];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2304];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1984];
                    gikz = gx[2720];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1920]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1920] - ylyk * gx[1728])) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1728];
                    Ix = gx[320];
                    Iy = gx[1152];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[352];
                    giy = gx[1184];
                    giz = gx[2912];
                    gkx = gx[512];
                    gky = gx[1344];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[288];
                    fkx = ak2 * gkx - 1 * gx[128];
                    fjx = aj2 * gjx - 1 * gx[224];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[544];
                    giky = gx[1376];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * (ai2 * gikx - 1 * gx[480]) - 1 * (ai2 * gx[160] - 1 * gx[96])) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[416]) - 1 * (aj2 * (gx[160] - xjxi * gx[128]) - 1 * gx[32])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[480] - xlxk * gx[288])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[416] - xlxk * gx[224])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[1984];
                    Ix = gx[192];
                    Iy = gx[1152];
                    Iz = gx[3008];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1184];
                    giz = gx[3040];
                    gkx = gx[384];
                    gky = gx[1344];
                    gkz = gx[3200];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2976];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2912];
                    flz = al2 * glz - 1 * gx[2432];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[1376];
                    gikz = gx[3232];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3168]) * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3104]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3168] - zlzk * gx[2976])) - 1 * (ai2 * gx[2464] - 1 * gx[2400])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3104] - zlzk * gx[2912])) - 1 * (aj2 * (gx[2464] - zjzi * gx[2432]) - 1 * gx[2336])) * prod_xy;
                    dd = dd_cache[2240];
                    Ix = gx[0];
                    Iy = gx[1376];
                    Iz = gx[2976];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1408];
                    giz = gx[3008];
                    gkx = gx[192];
                    gky = gx[1568];
                    gkz = gx[3168];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1344];
                    fky = ak2 * gky - 1 * gx[1184];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2880];
                    flz = al2 * glz - 1 * gx[2400];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1600];
                    gikz = gx[3200];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * (ai2 * giky - 1 * gx[1536]) - 1 * (ai2 * gx[1216] - 1 * gx[1152])) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1216] - yjyi * gx[1184])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3072]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1536] - ylyk * gx[1344])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2432]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3072] - zlzk * gx[2880])) - 1 * (aj2 * (gx[2432] - zjzi * gx[2400]) - 1 * gx[2304])) * prod_xy;
                    dd = dd_cache[2496];
                    Ix = gx[32];
                    Iy = gx[1152];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[1184];
                    giz = gx[3200];
                    gkx = gx[224];
                    gky = gx[1344];
                    gkz = gx[3360];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2976];
                    fjz = aj2 * gjz - 1 * gx[3072];
                    flz = al2 * glz - 1 * gx[2592];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[1376];
                    gikz = gx[3392];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[3008]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3264]) - 1 * (aj2 * (gx[3008] - zjzi * gx[2976]) - 1 * gx[2880])) * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2624]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3264] - zlzk * gx[3072])) - 1 * (aj2 * (gx[2624] - zjzi * gx[2592]) - 1 * gx[2496])) * prod_xy;
                    break;
                    case 7:
                    dd = dd_cache[224];
                    Ix = gx[768];
                    Iy = gx[1184];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[800];
                    giy = gx[1216];
                    giz = gx[2432];
                    gkx = gx[960];
                    gky = gx[1376];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[576];
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[192];
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[992];
                    giky = gx[1408];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[608]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[608] - xjxi * gx[576])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[224]) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[224] - xjxi * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[480];
                    Ix = gx[608];
                    Iy = gx[1344];
                    Iz = gx[2400];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[640];
                    giy = gx[1376];
                    giz = gx[2432];
                    gkx = gx[800];
                    gky = gx[1536];
                    gkz = gx[2592];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[576];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[32];
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2304];
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[832];
                    giky = gx[1568];
                    gikz = gx[2624];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[768]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[2496]) * prod_xy;
                    v_ixlx += (al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[768] - xlxk * gx[576])) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[64] - xjxi * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[2496] - zlzk * gx[2304])) * prod_xy;
                    dd = dd_cache[736];
                    Ix = gx[576];
                    Iy = gx[1248];
                    Iz = gx[2528];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[608];
                    giy = gx[1280];
                    giz = gx[2560];
                    gkx = gx[768];
                    gky = gx[1440];
                    gkz = gx[2720];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx - 1 * gx[0];
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1152];
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2336];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[800];
                    giky = gx[1472];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1344]) * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    v_ixlx += (al2 * ai2 * (gikx - xlxk * gix) - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += (al2 * aj2 * (gjkx - xlxk * gjx) - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyly += al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[992];
                    Ix = gx[192];
                    Iy = gx[1856];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[224];
                    giy = gx[1888];
                    giz = gx[2336];
                    gkx = gx[384];
                    gky = gx[2048];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[0];
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1824];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy - 1 * gx[1760];
                    fly = al2 * gly - 1 * gx[1280];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[416];
                    giky = gx[2080];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[32]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[2016]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * aj2 * gjkx - 1 * aj2 * (gx[32] - xjxi * gx[0])) * prod_yz;
                    v_jyky += ak2 * (aj2 * gjky - 1 * gx[1952]) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[2016] - ylyk * gx[1824])) - 1 * (ai2 * gx[1312] - 1 * gx[1248])) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[1952] - ylyk * gx[1760])) - 1 * (aj2 * (gx[1312] - yjyi * gx[1280]) - 1 * gx[1184])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1248];
                    Ix = gx[32];
                    Iy = gx[2016];
                    Iz = gx[2304];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[64];
                    giy = gx[2048];
                    giz = gx[2336];
                    gkx = gx[224];
                    gky = gx[2208];
                    gkz = gx[2496];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[0];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1824];
                    fjy = aj2 * gjy - 1 * gx[1920];
                    fly = al2 * gly - 1 * gx[1440];
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[256];
                    giky = gx[2240];
                    gikz = gx[2528];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[192]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1856]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * (aj2 * gjky - 1 * gx[2112]) - 1 * (aj2 * (gx[1856] - yjyi * gx[1824]) - 1 * gx[1728])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1472]) * prod_xz;
                    v_izlz += al2 * ai2 * (gikz - zlzk * giz) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += (al2 * (aj2 * (gjky - ylyk * gjy) - 1 * (gx[2112] - ylyk * gx[1920])) - 1 * (aj2 * (gx[1472] - yjyi * gx[1440]) - 1 * gx[1344])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1504];
                    Ix = gx[96];
                    Iy = gx[1728];
                    Iz = gx[2528];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[128];
                    giy = gx[1760];
                    giz = gx[2560];
                    gkx = gx[288];
                    gky = gx[1920];
                    gkz = gx[2720];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[0];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly - 1 * gx[1152];
                    fiz = ai2 * giz - 1 * gx[2496];
                    fkz = ak2 * gkz - 1 * gx[2336];
                    fjz = aj2 * gjz;
                    flz = al2 * glz;
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[320];
                    giky = gx[1952];
                    gikz = gx[2752];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * ai2 * giky * prod_xz;
                    v_izkz += (ak2 * (ai2 * gikz - 1 * gx[2688]) - 1 * (ai2 * gx[2368] - 1 * gx[2304])) * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[192]) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * aj2 * gjkz - 1 * aj2 * (gx[2368] - zjzi * gx[2336])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += (al2 * ai2 * (giky - ylyk * giy) - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izlz += al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[2688] - zlzk * gx[2496])) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[192] - xlxk * gx[0])) * prod_yz;
                    v_jyly += (al2 * aj2 * (gjky - ylyk * gjy) - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzlz += al2 * aj2 * (gjkz - zlzk * gjz) * prod_xy;
                    dd = dd_cache[1760];
                    Ix = gx[288];
                    Iy = gx[1184];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[320];
                    giy = gx[1216];
                    giz = gx[2912];
                    gkx = gx[480];
                    gky = gx[1376];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx - 1 * gx[96];
                    fjx = aj2 * gjx - 1 * gx[192];
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[512];
                    giky = gx[1408];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += (ak2 * ai2 * gikx - 1 * ai2 * gx[128]) * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += (ak2 * (aj2 * gjkx - 1 * gx[384]) - 1 * (aj2 * (gx[128] - xjxi * gx[96]) - 1 * gx[0])) * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[384] - xlxk * gx[192])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2016];
                    Ix = gx[128];
                    Iy = gx[1344];
                    Iz = gx[2880];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[160];
                    giy = gx[1376];
                    giz = gx[2912];
                    gkx = gx[320];
                    gky = gx[1536];
                    gkz = gx[3072];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix - 1 * gx[96];
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx - 1 * gx[32];
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz;
                    flz = al2 * glz - 1 * gx[2304];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[352];
                    giky = gx[1568];
                    gikz = gx[3104];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * (ai2 * gikx - 1 * gx[288]) * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * ai2 * gikz * prod_xy;
                    v_jxkx += ak2 * (aj2 * gjkx - 1 * gx[224]) * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * aj2 * gjkz * prod_xy;
                    v_ixlx += al2 * (ai2 * (gikx - xlxk * gix) - 1 * (gx[288] - xlxk * gx[96])) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2336]) * prod_xy;
                    v_jxlx += al2 * (aj2 * (gjkx - xlxk * gjx) - 1 * (gx[224] - xlxk * gx[32])) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * aj2 * (gjkz - zlzk * gjz) - 1 * aj2 * (gx[2336] - zjzi * gx[2304])) * prod_xy;
                    dd = dd_cache[2272];
                    Ix = gx[0];
                    Iy = gx[1344];
                    Iz = gx[3008];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1376];
                    giz = gx[3040];
                    gkx = gx[192];
                    gky = gx[1536];
                    gkz = gx[3200];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy;
                    fky = ak2 * gky - 1 * gx[1152];
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz - 1 * gx[2976];
                    fkz = ak2 * gkz;
                    fjz = aj2 * gjz - 1 * gx[2912];
                    flz = al2 * glz - 1 * gx[2432];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1568];
                    gikz = gx[3232];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += (ak2 * ai2 * giky - 1 * ai2 * gx[1184]) * prod_xz;
                    v_izkz += ak2 * (ai2 * gikz - 1 * gx[3168]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += (ak2 * aj2 * gjky - 1 * aj2 * (gx[1184] - yjyi * gx[1152])) * prod_xz;
                    v_jzkz += ak2 * (aj2 * gjkz - 1 * gx[3104]) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * ai2 * (giky - ylyk * giy) * prod_xz;
                    v_izlz += (al2 * (ai2 * (gikz - zlzk * giz) - 1 * (gx[3168] - zlzk * gx[2976])) - 1 * (ai2 * gx[2464] - 1 * gx[2400])) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3104] - zlzk * gx[2912])) - 1 * (aj2 * (gx[2464] - zjzi * gx[2432]) - 1 * gx[2336])) * prod_xy;
                    dd = dd_cache[2528];
                    Ix = gx[0];
                    Iy = gx[1184];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    gix = gx[32];
                    giy = gx[1216];
                    giz = gx[3200];
                    gkx = gx[192];
                    gky = gx[1376];
                    gkz = gx[3360];
                    gjx = gix - rjri[0] * Ix;
                    gjy = giy - rjri[1] * Iy;
                    gjz = giz - rjri[2] * Iz;
                    glx = gkx - xlxk * Ix;
                    gly = gky - ylyk * Iy;
                    glz = gkz - zlzk * Iz;
                    fix = ai2 * gix;
                    fkx = ak2 * gkx;
                    fjx = aj2 * gjx;
                    flx = al2 * glx;
                    fiy = ai2 * giy - 1 * gx[1152];
                    fky = ak2 * gky;
                    fjy = aj2 * gjy;
                    fly = al2 * gly;
                    fiz = ai2 * giz;
                    fkz = ak2 * gkz - 1 * gx[2976];
                    fjz = aj2 * gjz - 1 * gx[3072];
                    flz = al2 * glz - 1 * gx[2592];
                    v_ixky += fix * fky * Izdd;
                    v_ixkz += fix * fkz * Iydd;
                    v_iykx += fiy * fkx * Izdd;
                    v_iykz += fiy * fkz * Ixdd;
                    v_izkx += fiz * fkx * Iydd;
                    v_izky += fiz * fky * Ixdd;
                    v_jxky += fjx * fky * Izdd;
                    v_jxkz += fjx * fkz * Iydd;
                    v_jykx += fjy * fkx * Izdd;
                    v_jykz += fjy * fkz * Ixdd;
                    v_jzkx += fjz * fkx * Iydd;
                    v_jzky += fjz * fky * Ixdd;
                    v_ixly += fix * fly * Izdd;
                    v_ixlz += fix * flz * Iydd;
                    v_iylx += fiy * flx * Izdd;
                    v_iylz += fiy * flz * Ixdd;
                    v_izlx += fiz * flx * Iydd;
                    v_izly += fiz * fly * Ixdd;
                    v_jxly += fjx * fly * Izdd;
                    v_jxlz += fjx * flz * Iydd;
                    v_jylx += fjy * flx * Izdd;
                    v_jylz += fjy * flz * Ixdd;
                    v_jzlx += fjz * flx * Iydd;
                    v_jzly += fjz * fly * Ixdd;
                    gikx = gx[224];
                    giky = gx[1408];
                    gikz = gx[3392];
                    gjkx = gikx - rjri[0] * gkx;
                    gjky = giky - rjri[1] * gky;
                    gjkz = gikz - rjri[2] * gkz;
                    v_ixkx += ak2 * ai2 * gikx * prod_yz;
                    v_iyky += ak2 * (ai2 * giky - 1 * gx[1344]) * prod_xz;
                    v_izkz += (ak2 * ai2 * gikz - 1 * ai2 * gx[3008]) * prod_xy;
                    v_jxkx += ak2 * aj2 * gjkx * prod_yz;
                    v_jyky += ak2 * aj2 * gjky * prod_xz;
                    v_jzkz += (ak2 * (aj2 * gjkz - 1 * gx[3264]) - 1 * (aj2 * (gx[3008] - zjzi * gx[2976]) - 1 * gx[2880])) * prod_xy;
                    v_ixlx += al2 * ai2 * (gikx - xlxk * gix) * prod_yz;
                    v_iyly += al2 * (ai2 * (giky - ylyk * giy) - 1 * (gx[1344] - ylyk * gx[1152])) * prod_xz;
                    v_izlz += (al2 * ai2 * (gikz - zlzk * giz) - 1 * ai2 * gx[2624]) * prod_xy;
                    v_jxlx += al2 * aj2 * (gjkx - xlxk * gjx) * prod_yz;
                    v_jyly += al2 * aj2 * (gjky - ylyk * gjy) * prod_xz;
                    v_jzlz += (al2 * (aj2 * (gjkz - zlzk * gjz) - 1 * (gx[3264] - zlzk * gx[3072])) - 1 * (aj2 * (gx[2624] - zjzi * gx[2592]) - 1 * gx[2496])) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ka)*9 + 0, v_ixkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 1, v_ixky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 2, v_ixkz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 3, v_iykx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 4, v_iyky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 5, v_iykz);
        atomicAdd(ejk + (ia*natm+ka)*9 + 6, v_izkx);
        atomicAdd(ejk + (ia*natm+ka)*9 + 7, v_izky);
        atomicAdd(ejk + (ia*natm+ka)*9 + 8, v_izkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 0, v_jxkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 1, v_jxky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 2, v_jxkz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 3, v_jykx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 4, v_jyky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 5, v_jykz);
        atomicAdd(ejk + (ja*natm+ka)*9 + 6, v_jzkx);
        atomicAdd(ejk + (ja*natm+ka)*9 + 7, v_jzky);
        atomicAdd(ejk + (ja*natm+ka)*9 + 8, v_jzkz);
        atomicAdd(ejk + (ia*natm+la)*9 + 0, v_ixlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 1, v_ixly);
        atomicAdd(ejk + (ia*natm+la)*9 + 2, v_ixlz);
        atomicAdd(ejk + (ia*natm+la)*9 + 3, v_iylx);
        atomicAdd(ejk + (ia*natm+la)*9 + 4, v_iyly);
        atomicAdd(ejk + (ia*natm+la)*9 + 5, v_iylz);
        atomicAdd(ejk + (ia*natm+la)*9 + 6, v_izlx);
        atomicAdd(ejk + (ia*natm+la)*9 + 7, v_izly);
        atomicAdd(ejk + (ia*natm+la)*9 + 8, v_izlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 0, v_jxlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 1, v_jxly);
        atomicAdd(ejk + (ja*natm+la)*9 + 2, v_jxlz);
        atomicAdd(ejk + (ja*natm+la)*9 + 3, v_jylx);
        atomicAdd(ejk + (ja*natm+la)*9 + 4, v_jyly);
        atomicAdd(ejk + (ja*natm+la)*9 + 5, v_jylz);
        atomicAdd(ejk + (ja*natm+la)*9 + 6, v_jzlx);
        atomicAdd(ejk + (ja*natm+la)*9 + 7, v_jzly);
        atomicAdd(ejk + (ja*natm+la)*9 + 8, v_jzlz);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

int rys_ejk_ip2_type3_unrolled(RysIntEnvVars *envs, JKEnergy *jk, BoundsInfo *bounds,
                        int *pool, double *dd_pool)
{
    int li = bounds->li;
    int lj = bounds->lj;
    int lk = bounds->lk;
    int ll = bounds->ll;
    int ijkl = li*125 + lj*25 + lk*5 + ll;
    int nroots = bounds->nroots;
    int nsq_per_block = 256;
    int gout_stride = 1;

    switch (ijkl) {
    case 131:
        nsq_per_block = 64;
        gout_stride = 4;
        break;
    case 155:
        nsq_per_block = 64;
        gout_stride = 4;
        break;
    case 156:
        nsq_per_block = 32;
        gout_stride = 8;
        break;
    }

    cudaDeviceProp prop;
    cudaGetDeviceProperties(&prop, 0);
    int workers = prop.multiProcessorCount;
    int *head = pool + workers * QUEUE_DEPTH;
    cudaMemset(head, 0, sizeof(int));

    dim3 threads(nsq_per_block, gout_stride);
    int iprim = bounds->iprim;
    int jprim = bounds->jprim;
    int buflen = nroots*2 * nsq_per_block + iprim*jprim;
    switch (ijkl) {
    case 0:
        rys_ejk_ip2_type3_0000<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 125:
        rys_ejk_ip2_type3_1000<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 130:
        rys_ejk_ip2_type3_1010<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 131:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type3_1011, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type3_1011<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 150:
        rys_ejk_ip2_type3_1100<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 155:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type3_1110, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type3_1110<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 156:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type3_1111, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type3_1111<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    default: return 0;
    }
    return 1;
}
